<!--检测点列表其中有个弹窗设置型号等-->
<template>
	<view>
		<!-- <button class="btn" @click="showAdd" size="mini" type="primary">+ &nbsp;新增</button> -->
		<Tab @change="changeParam" :tabList="tabList" :activeIndex="activeIndex"></Tab>
		<Listscroll requestUrl="/app/infoman/information/list" :params="params">
			<template #default="scope">
				<view class="notice-item" v-for="(item,i) in  scope.list" :key="i" @click="showDetail(item)">
					<view class="notice-item__title">
						<view class="title">{{item.title  }}</view>
						<view class="type">{{status[item.auditStatus]}}</view>
					</view>
					<view class="notice-item__containter">
						<text>类型：</text>{{types[item.category]}}
					</view>
				</view>
			</template>
		</Listscroll>
	</view>
</template>

<script setup>
import {ref} from "vue"
import Tab from '@/components/tabs/tabs2.vue';
import Listscroll from "@/components/list-scroll/list-scroll.vue"
import { getClassify } from "@/api/user.js"
const params = ref({auditStatus: -1})
const types = ref({})
const status = ref({
	'-1': "待审核",
	1: "已审核",
	0: "已驳回"
})
const activeIndex = ref(0)
const tabList = ref([
    // { tabName: '待审批',  tabId: '-1', id: 0 },
    { tabName: '已检测',  tabId: 1, id: 1},
    { tabName: '未检测',  tabId: 0, id: 2}
])
const showAdd = ()=> {
	uni.navigateTo({ url: `/pages/msgAuditDetail/msgAuditEdit`})
}

const changeParam = (idx)=> {
	console.log('idx-===',idx)
	const item = tabList.value.filter(v=>v.tabId === idx);
	activeIndex.value = item[0].id;
	console.log('activeIndex===', activeIndex.value)
	params.value.auditStatus = idx;
}
const getClassifyFn= (parentId, isSub)=> {
	getClassify({parentId}).then(res=> {
		let data = res.data;
		let arr = {};
		data.map(v=> {
			arr[v.id]=v.dictValue;
		})
		if(isSub) {
			subTypes.value = arr;
		} else {
			types.value = arr;
		}
	})
}
getClassifyFn('1648222707724197889');
const showDetail = (item)=> {
	uni.navigateTo({ url: `/pages/msgAuditDetail/msgAuditDetail?id=${item?.id || ''}`})
}

</script>

<style lang="scss" scoped>
.notice-item {
	display: flex;
	flex-direction: column;
	background: #fff;
	border-radius: 10rpx;
	margin: 20rpx 30rpx 0 30rpx;
	padding: 20rpx;
	cursor: pointer;
}
.notice-item__title {
	display: flex;
	justify-content: space-between;
	margin-bottom: 10rpx;
	.title {
		font-weight: bold;
		font-size: 28rpx;
		color: #455BDF;
	}
	.type {
		display: inline-block;
		padding: 4rpx 8rpx;
		background: #fef0f0;
		border:2rpx solid #fde2e2;
		color: rgb(251, 69, 59);
		border-radius: 10rpx;
		font-size: 20rpx;
		
	}
}
.notice-item__containter {
	text-overflow: -o-ellipsis-lastline;
	overflow: hidden;
	text-overflow: ellipsis;
	display: flex;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	font-size: 28rpx;
	text {
		font-size: 20rpx;
		color: #999;
	}
}
.btn{
	margin: 30rpx 0 0 30rpx;
	height: 80rpx;
	line-height: 80rpx;
	font-size: 28rpx;
}
</style>
